<template>
  <!--文本域-->
  <div class="input-text-box">
    <div class="input-text-title">
      <p v-text="title"></p>
    </div>
    <div class="input-text">
      <textarea :value="value"
                @input="inputChange"
                :disabled="readOnly"
                rows="1"
                :placeholder="placeholder_def">
      </textarea>
    </div>
  </div>
</template>

<script>
    export default {
        props: {
            value:{
                type: Object,
                default: () => null
            },
            title:{
                type: String,
                default: () => "多行文本"
            },
            placeholder:{
                type: String,
                default: () => null
            },
            readOnly:{
                type: Boolean,
                default: () => false
            },
        },
        data() {
            return {
                placeholder_def: this.placeholder == null? "请输入" + this.title : this.placeholder
            }
        },
        methods: {
            inputChange(e) {
                this.$emit("input", e.target.value);
            }
        }
    }
</script>

<style scoped>
  textarea, textarea:focus {
    background: none;
    outline: none;
    border: none;
  }
  .input-text-box {
    width: 100%;
    height: 30px;
    margin: 15px auto;
  }
  .input-text-title {
    cursor: default;
    float: left;
    width: 20%;
    height: 100%;
    line-height: 30px;
    font-size: 14px;
    letter-spacing: 1.5px;
  } .input-text-title p {
      width: 100%;
      margin: 0 0;
      text-align: center;
      color: rgba(255, 255, 255,0.5);
    }
  .input-text {
    float: left;
    width: 70%;
  }
  .input-text textarea {
    cursor: text;
    resize: vertical;
    border: 1px solid #2b313e;
    border-radius: 3px;
    width: 100%;
    max-height: 100px;
    padding: 6px 8px;
    font-family: 'Avenir', Helvetica, Arial, sans-serif;
    font-size: 13px;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255,0.5);
    background-color: #222833; /*背景颜色*/
    transition: 0.15s;
  }
  .input-text textarea:focus {
    border: 1px solid #39404d;
  }
  .input-text textarea::placeholder {
    color: rgba(255, 255, 255,0.2);
    font-weight: lighter;
  }

  /*整个滚动条*/
  ::-webkit-scrollbar {
    width: 8px;
    height: 0px;
  }
  /*滑块*/
  ::-webkit-scrollbar-thumb {
    border-radius: 10px;
    /* -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2); */
    background: rgba(0, 0, 0, 0.11);
  }
  /*滑块的轨道*/
  /* ::-webkit-scrollbar-track {
      -webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
      border-radius: 0;
      background: rgba(0, 0, 0, 0);
  } */
</style>
